#include "include/borealis/Interpolation.hpp"
namespace Borealis
{
	namespace internal
	{
		void InverseDistanceWeighting(tbb::concurrent_vector<raster_point<float> >& points,boost::shared_ptr<raster<float> > raster, raster_visitor<float>* visitor)
		{
			if (!raster)
				throw std::runtime_error("Null raster");
			if(points.size()==0)
				throw std::runtime_error("No points");

			tbb::blocked_range2d<unsigned int> range(0,raster->get_row(),0,raster->get_col());
			tbb::parallel_for(range,apply_idw(raster,&points,visitor));
		}

		void ThinPlateSplineT( tbb::concurrent_vector<raster_point<float> >& points,boost::shared_ptr<raster<float> > raster, raster_visitor<float>* visitor /*= NULL*/, double tension /*= 0.1*/ )
		{
			if (!raster)
				throw std::runtime_error("Null raster");
			if(points.size()==0)
				throw std::runtime_error("No points");

			tbb::blocked_range2d<unsigned int> range(0,raster->get_row(),0,raster->get_col());
			tbb::parallel_for(range,apply_tpst(raster,&points,visitor));

		}
	}
}

